<script type="text/javascript">
            $(function() {
              $('#add_prod').tabs({ fxSlide: false, fxFade: false, fxSpeed: 'normal' });
            });
			$(document).ready(function(){
					$('.filter_clicked ul li a span').click(function(){
							var Itlass = $(this).attr('class');
							//console.log(Itlass);
							//return false;
							$('#DateFilter').attr('name','data[Message]['+Itlass+']')	
						});
					
					
				});
        </script>

<div class="container">
  <h2 class="main_title">Buyer-Seller Messages </h2>
  <div class="def_width_100 text_def_13">Review all your communication between yourself and your buyers. You can view the message details or the related order information. <a href="#" class="blue_link">Learn more</a></div>
  <div class="sell_ser_prod">
    <div class="pad_10"></div>
    <div class="def_width_100 f_left">
	  <?php echo $form->create('Seller', array('action'=>'','method'=>'post','class' => 'mws-form')); ?>
      <div class="def_width_100 f_left">
<!--        <input type="text" class="text_b_280" name="" style=" margin-left:10px;">
        <select name="" class="select_count1">
          <option>1</option>
          <option>2</option>
          <option>3</option>
        </select>
        <input name="" type="submit" value="Search" class="form_btn">
-->      </div>
      <div class=" width_60 f_left" style="padding-left:10px;">
        <ul class="ul_prod_listing">
          <li>
            <p><b>Filter results:</b><br/>
            <div class="def_width_100 f_left">
            
                <select  class="select_count1" id="DateFilter" name="data[Message][Sent]">
                  <option value="3_d">Last 3 days</option>
                  <option value="7_d">Last 7 days</option>
                  <option value="14_d">Last 14 days</option>
                  <option value="30_d" selected="selected">Last 30 days</option>
                  <option value="90_d">Last 90 days</option>
                  <option value="180_d">Last 180 days</option>
                  <option value="1_Y">Last 1 Year</option>
                  <option value="2_Y">Year 2 Year</option>
                </select>
            </div>
            <br>
            <p>
            <p><a href="#" class="blue_link">Add filter</a>&nbsp;|&nbsp; <a href="#" class="blue_link">Clear Filter</a></p>
            <div class="def_width_100 f_left">
              <input name="" type="submit" class="form_btn_2" value="Apply Filter">
            </div>
          </li>
          <li></li>
        </ul>
      </div>
        <?php echo $form->end(); ?>
    </div>
  </div>
  <div class="def_width_100 f_left">
    <div class="width_20 f_left">
      <h2 class="left_title">Need Some Help?</h2>
      <div class="sellerMain_gary">
        <div style="line-height:1.4em;"> <a href="#">Buyer-Seller Messaging Service Help</a> </div>
      </div>
      <h2 class="left_title">Tools and Resource</h2>
      <div class="sellerMain_gary">
        <div style="line-height:1.4em;"> <a target="_blank" href="#"> Alternate Address </a><br>
        </div>
      </div>
    </div>
    <div class="width_79 f_right"> 
      <!--*************************************-->
      <div class="def_width_100 f_left filter_clicked" id="add_prod">
        <ul>
          <li><a href="#fragment-13"><span class="Sent">Sent Message </span></a></li>
          <li><a href="#fragment-14"><span class="Recieved">Recieved Message</span></a></li>
        </ul>
        <div id="fragment-13">
          <div class="paging_gray f_left">
          <!--  <label>Filter
              <select name="" class="select_count1">
                <option>1</option>
                <option>2</option>
                <option>3</option>
              </select>
            </label>-->
          </div>
          <div class="common_border"></div>
          <div class="def_width_100 f_left">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="grid_table_list_2">
              <tbody>
                <tr class="tGb_blk">
                  <th width="4%">&nbsp;</th>
                  <th width="16%">Date</th>
                  <th width="19%">Send to</th>
                  <th width="40%">Subject</th>
                  <th width="19%">Reference</th>
                </tr>
			<?php
			if(isset($messages) and ($messages))
				{	
					$v =0;
					foreach($messages as $message)
						{
							if(($v%2)==0)
								{
									$bdcolor = "#f2f2f2";
								}else{
									$bdcolor ="";
								}
					?>
                <tr bgcolor="<?php echo $bdcolor; ?>">
                  <td width="4%">&nbsp;</td>
                  <td width="16%"><?php echo date('d-M-Y', strtotime($message['Message']['created'])); ?></td>
                  <td width="19%"><?php 
									echo $html->link($message['Message']['User']['name'], 
									array('controller'=>'sellers', 'action'=>'seller_do_mail',
									$message['Message']['User']['hash'], $message['Message']['order_id']), array('class'=>'blue_link'));
								 ?></td>
                  <td width="40%"><?php 
									echo $html->link($message['Message']['Subject'], 
									array('controller'=>'sellers', 'action'=>'view_mail',
									$message['Message']['hash']), array('class'=>'brown_link'));
								 ?></td>
                  <td width="19%"><a href="javascript:void(0); return false;"  class="blue_link"><?php echo $message['Message']['order_id']; ?></a></td>
                </tr>
                <?php
						$v++;}
				}
				else
				{
					?> <tr bgcolor=""> <td  colspan="5" style="text-align:center; width: 100%;">No Messages Yet!</td></tr><?php
				}
			?>
            </table>
          </div>
        </div>
        <div id="fragment-14">
          <div class="paging_gray f_left">
            <!--<label>Filter
              <select name="" class="select_count1">
                <option>1</option>
                <option>2</option>
                <option>3</option>
              </select>
            </label>-->
          </div>
          <div class="common_border"></div>
          <div class="def_width_100 f_left">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="grid_table_list_2">
              <tbody>
                <tr class="tGb_blk">
                  <th width="4%">&nbsp;</th>
                  <th width="16%">Date</th>
                  <th width="19%">Send to</th>
                  <th width="40%">Subject</th>
                  <th width="19%">Reference</th>
                </tr>
			<?php
			if(isset($Seller_Recievedmail) and ($Seller_Recievedmail))
				{
					$c=0;
					foreach($Seller_Recievedmail as $message)
						{
							if(($c%2)==0)
								{
									$bdcolor = "#f2f2f2";
								}else{
									$bdcolor ="";
								}
					?>
                                <tr bgcolor="<?php echo $bdcolor; ?>">
                                  <td width="4%">&nbsp;</td>
                                  <td width="16%"><?php echo date('d-M-Y', strtotime($message['Message']['created'])); ?></td>
                                  <td width="19%"><?php 
                                                    echo $html->link($message['Message']['ToUser']['name'], 
                                                    array('controller'=>'Users', 'action'=>'profile',
                                                    $message['Message']['ToUser']['slug']), array('class'=>'blue_link'));
                                                 ?></td>
                                  <td width="40%"><?php 
                                                    echo $html->link($message['Message']['Subject'], 
									array('controller'=>'sellers', 'action'=>'view_mail',
									$message['Message']['hash']), array('class'=>'brown_link'));
                                                 ?></td>
                                  <td width="19%"><a href="javascript:void(0); return false;" class="blue_link"><?php echo $message['Message']['order_id']; ?></a></td>
                                </tr>
                <?php
					$c++;	}
				}else
				{
					?>
                    <tr bgcolor=""> <td  colspan="5" style="text-align:center; width: 100%;">No Messages Yet!</td></tr>
                    <?php
				}
			?>
                <tr>
            </table>
          </div>
        </div>
      </div>
    </div>
    <!--************************************--> 
  </div>
</div>
